package com.dtsheep.elasticsearch.es.client.document;

import com.dtsheep.elasticsearch.es.client.ElasticsearchClientUtil;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;

import java.io.IOException;

/**
 * GetDocument
 *
 * <p>
 * </p>
 *
 * @author chuanbai
 * @date 2024/5/24
 */
public class GetDocument {

    public static void main(String[] args) throws IOException {
        RestHighLevelClient client = ElasticsearchClientUtil.getEsClient();

        GetResponse response = client.get(new GetRequest()
                .index("user")
                .id("1"), RequestOptions.DEFAULT);

        System.out.println(response.getSourceAsString());

    }
}
